<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="__PUBLIC__/Css/manager.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="__PUBLIC__/Js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $('table tr').hover(function(){
                $(this).addClass('hover');
            },function(){
                $(this).removeClass('hover');
            });
            $("input[name='checkAll']").click(function(){
                if($(this).attr("checked")){
                    $.each($("#relUser input[type='checkbox']"),function(){
                        $(this).attr("checked",true);
                    });
                }else{
                    $.each($("#relUser input[type='checkbox']"),function(){
                        $(this).attr("checked",false);
                    });
                }
            });

            $("input[name='checkAll2']").click(function(){
                if($(this).attr("checked")){
                    $.each($("#relUser2 input[type='checkbox']"),function(){
                        $(this).attr("checked",true);
                    });
                }else{
                    $.each($("#relUser2 input[type='checkbox']"),function(){
                        $(this).attr("checked",false);
                    });
                }
            });
        })
    </script>
    <title>分配用户</title>
</head>
<body>
<div>
    <div>
        角色组名:{$role['name']}<br>
        英文名:{$role['ename']}<br>
        备注说明:{$role['remark']}
    </div>
</div>
<div>
    <form action="__URL__/delete" id="deleteForm" method="POST">
        <input type="hidden" value="{$role['id']}" name="role_id">
        <h2>当前组下用户</h2>
        <script type="text/javascript">
            $(document).ready(function(){
                $("#addBtn").click(function(){
                    $.post(
                            "__URL__/delete",
                            $('#deleteForm').serialize(),
                            function(data){
                                alert(decodeURI(data.info));
                                if(data.status!=2){
                                    window.location.href=data['data'];
                                }
                            },
                            "json"
                    );
                });
            });
        </script>
        <input type="button" id="addBtn" value="删除用户与用户组关联">
        <table style="width: 100%" border="0" cellspacing="0" id="relUser">
            <tr class="title">
                <th>
                    <input type="checkbox" name="checkAll">
                </th>
                <th>用户名</th>
                <th>昵称</th>
                <th>头像</th>
                <th>创建时间</th>
                <th>激活状态</th>
                <th>所属角色组</th>
            </tr>
            <volist name="list" id="user">
                <tr align="left">
                    <td>
                        <input type="checkbox" value="{$user['id']}" name="user_id[]">
                    </td>
                    <td>{$user["username"]}</td>
                    <td>{$user["nickname"]}</td>
                    <td><img src="__PUBLIC__/Uploads/faceimg/s_{$user['faceimg']}" alt="头像"></td>
                    <td>{$user["createtime"]|date="Y-m-d H:i:s",###}</td>
                    <td>
                        <if condition="$user['status'] eq 1">
                            活动状态
                            <elseif condition="$user['status'] eq 0"/>
                            冻结状态
                        </if>
                    </td>
                    <td>
                        <volist name="allRelam" id="relam">
                            <if condition="$relam['user_id'] eq $user['id']">
                                <volist name="allRole" id="roleItem">
                                    <if condition="$roleItem['id'] eq $relam['role_id']">
                                        [{$roleItem['name']}]
                                    </if>
                                </volist>
                            </if>
                        </volist>
                    </td>
                </tr>
            </volist>

        </table>
    </form>

    <br>
    <br>
    <form action="__URL__/insert" method="POST" id="insertForm">
        <input type="hidden" value="{$role['id']}" name="role_id">
        <h2>未在当前组下用户</h2>
        <input type="button" id="addBtn2" value="关联用户与用户组">
        <script type="text/javascript">
            $(document).ready(function(){
                $("#addBtn2").click(function(){
                    $.post(
                            "__URL__/insert",
                            $('#insertForm').serialize(),
                            function(data){
                                alert(decodeURI(data.info));
                                if(data.status!=2){
                                    window.location.href=data['data'];
                                }
                            },
                            "json"
                    );
                });
            });
        </script>
        <table style="width: 100%" border="0" cellspacing="0" id="relUser2">
            <tr class="title">
                <th>
                    <input type="checkbox" name="checkAll2">
                </th>
                <th>用户名</th>
                <th>昵称</th>
                <th>头像</th>
                <th>创建时间</th>
                <th>激活状态</th>
                <th>所属角色组</th>
            </tr>
            <volist name="list2" id="user">
                <tr align="left">
                    <td>
                        <input type="checkbox" value="{$user['id']}" name="user_id2[]">
                    </td>
                    <td>{$user["username"]}</td>
                    <td>{$user["nickname"]}</td>
                    <td><img src="__PUBLIC__/Uploads/faceimg/s_{$user['faceimg']}" alt="头像"></td>
                    <td>{$user["createtime"]|date="Y-m-d H:i:s",###}</td>
                    <td>
                        <if condition="$user['status'] eq 1">
                            活动状态
                            <elseif condition="$user['status'] eq 0"/>
                            冻结状态
                        </if>
                    </td>
                    <td>
                        <volist name="allRelam" id="relam">
                            <if condition="$relam['user_id'] eq $user['id']">
                                <volist name="allRole" id="roleItem">
                                    <if condition="$roleItem['id'] eq $relam['role_id']">
                                        [{$roleItem['name']}]
                                    </if>
                                </volist>
                            </if>
                        </volist>
                    </td>
                </tr>
            </volist>

        </table>
    </form>
</div>


</body>
</html>